
#include <iostream>
#include <cstring>
using namespace std;

class Stack {
	public:
		Stack( ) : m_size( 0 )	{ }
		bool push( int data ) {
			if( m_size >= 20 )
				return false;
			m_a[m_size++] = data;
			return true;
		}
		int pop( ) { return m_a[--m_size]; }
		int size( ) { return m_size; }
		const int& operator[]( size_t index ) const {
			return m_a[ index ];
		}
		int& operator[]( size_t index ) {
			return m_a[ index ];
		}
	private:
		int m_a[20];
		int m_size;
};

// designer
// ------------------------------------------------------------------
// user

int main( void ) { 
	Stack s;
	for( int i = 0; i < 20; i++ )
		s.push( 1000 + i );
	cout << "members : " << s.size( ) << endl;

	/*
	for( int i = 0; i < 20; i++ )
		cout << s.pop( ) << ' ' ;
	cout << endl;
	
	cout << "after members : " << s.size( ) << endl;
	*/
	s[5] = 8888;
	cout << "s[5] : " << s[5] << endl;
	for( int j = 0; j < 20; j++)
		cout << s[j] << ' ';
	cout << endl;
	cout << "members : " << s.size( ) << endl;

	const Stack cs = s;
	cs[5] = 6666;

	return 0;
}

